﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.HtmlControls;

/// <summary>
///Basic 的摘要说明
/// </summary>
public class Basic : System.Web.UI.Page
{
    public Basic()
    {
    }

    private string _jsonUrl = "http://172.28.1.90/";
    ///<summary>
    ///
    ///</summary>
    public string jsonUrl
    {
        get { return _jsonUrl; }
    }

    private string _wwwUrl = "http://www.ymcps.com/";
    ///<summary>
    ///
    ///</summary>
    public string wwwUrl
    {
        get { return _wwwUrl; }
    }

    public string NewsUrl
    {
        get
        {
            return "http://news.emoney.cn/";
        }
    }

    private string _quoteUrl = "http://stock.emoney.cn/";
    ///<summary>
    ///
    ///</summary>
    public string quoteUrl
    {
        get { return _quoteUrl; }
    }

    private string _quoteImgUrl = "http://chart.emoney.cn/";
    ///<summary>
    ///
    ///</summary>
    public string quoteImgUrl
    {
        get { return _quoteImgUrl; }
    }

    private string _serviceUrl = "http://kefu.emoney.cn/";
    ///<summary>
    ///
    ///</summary>
    public string serviceUrl
    {
        get { return _serviceUrl; }
    }

    private string _payUrl = "http://pay.emoney.cn/";
    ///<summary>
    ///
    ///</summary>
    public string payUrl
    {
        get { return _payUrl; }
    }

    public string GetNewsUrl(string m, string tid, object id)
    {
        return NewsUrl + "n_" + m + "_" + tid + "_" + id.ToString() + ".shtml";
    }

    public string GetNewListUrl(string m, string typeId, int page = 1)
    {
        return NewsUrl + "news_" + m + "_" + typeId + "_" + page + ".shtml";
    }

    public string GetNewListUrl(int page = 1)
    {
        return NewsUrl + "news_" + page+".shtml";
    }

    private string _infoUrl = "http://www.ymcps.com/Introduce/";
    ///<summary>
    ///
    ///</summary>
    public string infoUrl
    {
        get { return _infoUrl; }
    }

    public Dictionary<string, ChannelEnty> DictChannel()
    {
        Dictionary<string, ChannelEnty> dict = new Dictionary<string, ChannelEnty>();
        ChannelEnty et = new ChannelEnty();
        et.Name = "首页";
        et.Url = wwwUrl;
        dict.Add("00", et);
        et = new ChannelEnty();
        et.Name = "必读";
        et.Url = wwwUrl + "dayRead.htm";
        dict.Add("01", et);
        et = new ChannelEnty();
        et.Name = "新股";
        et.Url = wwwUrl + "newStock.htm";
        dict.Add("02", et);
        et = new ChannelEnty();
        et.Name = "行业";
        et.Url = wwwUrl + "Industry.htm";
        dict.Add("03", et);
        et = new ChannelEnty();
        et.Name = "研究";
        et.Url = wwwUrl + "report.htm";
        dict.Add("04", et);
        et = new ChannelEnty();
        et.Name = "热点专题";
        et.Url = wwwUrl + "topic/index.htm";
        dict.Add("05", et);
        et = new ChannelEnty();
        et.Name = "特色推荐";
        et.Url = quoteUrl;
        dict.Add("06", et);
        et = new ChannelEnty();
        et.Name = "千股千评";
        et.Url = quoteUrl + "Bk_GGPh.htm";
        dict.Add("07", et);
        et = new ChannelEnty();
        et.Name = "操盘信号";
        et.Url = quoteUrl + "Bk_BSPh.htm";
        dict.Add("08", et);
        et = new ChannelEnty();
        et.Name = "主力资金";
        et.Url = quoteUrl + "Bk_ZLPh.htm";
        dict.Add("09", et);
        et = new ChannelEnty();
        et.Name = "行情";
        et.Url = quoteUrl;
        dict.Add("10", et);
        et = new ChannelEnty();
        et.Name = "大盘";
        et.Url = quoteUrl + "Dp.htm";
        dict.Add("11", et);
        et = new ChannelEnty();
        et.Name = "板块";
        et.Url = quoteUrl + "Bk.htm";
        dict.Add("12", et);
        et = new ChannelEnty();
        et.Name = "个股";
        et.Url = quoteUrl + "Gg.htm";
        dict.Add("13", et);
        et = new ChannelEnty();
        et.Name = "专家课堂";
        et.Url = quoteUrl + "zhuajia.htm";
        dict.Add("14", et);
        et = new ChannelEnty();
        et.Name = "产品中心";
        et.Url = payUrl;
        dict.Add("15", et);
        et = new ChannelEnty();
        et.Name = "客服中心";
        et.Url = serviceUrl;
        dict.Add("16", et);
        return dict;
    }

    public string _title = "益盟操盘手";
    public string _encode = string.Empty;
    public string _lang = string.Empty;
    public string _desc = string.Empty;
    public string _keywords = string.Empty;


    /// <summary>
    /// 设置页头信息
    /// </summary>
    /// <param name="_tit">本页标题</param>
    /// <param name="_encode">本页编码</param>
    /// <param name="_lang">本页语言</param>
    /// <param name="_desc">描述语言</param>
    /// <param name="_keywords">关键词</param>
    public void BasicHeader(string _tit, string _encode, string _lang, string _desc, string _keywords)
    {
        //Page title
        if (!String.IsNullOrEmpty(_tit))
            Page.Title = _tit;

        //Encode/Content type
        HtmlMeta encode = new HtmlMeta();
        encode.HttpEquiv = "Content-Type";
        if (String.IsNullOrEmpty(_encode))
            encode.Content = "text/html; charset=gb2312";
        else
            encode.Content = "text/html; charset=" + _encode + "";
        Page.Header.Controls.Add(encode);

        //Language
        HtmlMeta lang = new HtmlMeta();
        lang.HttpEquiv = "Content-Language";
        if (String.IsNullOrEmpty(_encode))
            lang.Content = "zh-cn";
        else
            lang.Content = _lang;
        Page.Header.Controls.Add(lang);

        //Description
        HtmlMeta desc = new HtmlMeta();
        desc.Name = "Description";
        desc.Content = _desc;
        Page.Header.Controls.Add(desc);

        //Keyword
        HtmlMeta keywords = new HtmlMeta();
        keywords.Name = "keywords";
        keywords.Content = _keywords;
        Page.Header.Controls.Add(keywords);

    }


}